
/**
 * // 新增行事件
function addRow(e) {
	var btid = e.source.id;//addbt_
	var index = btid.indexOf("_addbt_");
	var gridname = btid.substring(7+index);
	var grid = mini.get(btid.substring(7+index));
	console.log(e.source.id);
	// 判断是进行哪个子表的增加事件
    if("t_equipment_install_addbt_equipment_list_datagrid" == e.source.id.toLowerCase()){// 安装单的设备list
    	addEquipmentList(grid); 
     }else if("t_purchase_addbt_equipment_list_datagrid" == e.source.id.toLowerCase()){// 采购单设备list
    	addEquipmentList(grid); 
     }else if("t_equipment_scrap_addbt_equipment_list_datagrid" == e.source.id.toLowerCase()){// 报废单设备list
    	addEquipmentList(grid); 
     }else if("t_in_notice_addbt_equipment_list_datagrid" == e.source.id.toLowerCase()){// 入库设备list
    	 addEquipmentList(grid); 
     }else if("t_scrap_call_addbt_equipment_list_datagrid" == e.source.id.toLowerCase()){// 报废调拨单设备list
    	 addEquipmentList(grid); 
     }else if("t_inventory_call_addbt_equipment_list_datagrid" == e.source.id.toLowerCase()){// 库存调拨单设备list
    	 addEquipmentList(grid); 
     }else if("t_equipment_service_addbt_new_equipment_detail_datagrid" == e.source.id.toLowerCase()){// 维修单出库设备list
    	 addEquipmentList1(grid); 
     }else if("t_equipment_service_addbt_service_equipment_detail_datagrid" == e.source.id.toLowerCase()){// 维修单可维修设备list
    	 addEquipmentList2(grid); 
     }else if("t_equipment_service_addbt_call_equipment_detail_datagrid" == e.source.id.toLowerCase()){// 维修单报废设备list
    	 addEquipmentList3(grid); 
     }else if("t_inventory_check_addbt_storage_list_datagrid" == e.source.id.toLowerCase()){//库存盘点的仓库list
    	 addStorageList(grid);
     }else if("t_equipment_install_addbt_equipment_detail_datagrid" == e.source.id.toLowerCase() ){//安装单的设备detail
    	 copyList2Detail();
     }else if("t_inventory_call_addbt_equipment_list_out_datagrid" == e.source.id.toLowerCase()){ // 库存调拨单的出库表
    	 // 将清单表的数据复制到出库表
    	 copyList2Out();
     }else if("t_inventory_call_addbt_equipment_list_in_datagrid" == e.source.id.toLowerCase()){ // 库存调拨单的入库表
    	 copyOut2In();
     }else if("t_scrap_call_addbt_equipment_list_out_datagrid" == e.source.id.toLowerCase()){ // 报废调拨单的出库表
    	 addEquipmentList(gridname); 
     }else if("t_scrap_call_addbt_equipment_list_in_datagrid" == e.source.id.toLowerCase()){ // 报废调拨单的入库表
    	 copyOut2In();
     }else if("t_inventory_check_addbt_storage_list_datagrid" == e.source.id.toLowerCase()){ // 盘点单仓库添加
    	 addStorageList();
     }else if("t_inventory_check_addbt_equipment_list_datagrid" == e.source.id.toLowerCase()){ // 盘点单设备添加
    	 addEquipmentList();
     }else if("t_shop_check_addbt_shop_list_datagrid" == e.source.id.toLowerCase()){ // 盘点单设备添加
    	 addEquipmentList();
     }else if("t_inventory_check_addbt_shop_list_datagrid" == e.source.id.toLowerCase()){ // 盘点单设备添加
    	 addShopList();
     }else{
    	 mini.alert("未配置该子表的新增方法");
    	// grid.addRow({});
     }
} 
*/


// 设备详情新增
function addEquipmentDetail(grid){
	mini.open({
		url: projectName+"/TableDefineAdmin/addequipment_detail",
		title: "新增", width: 700, height: 300,
		onload: function () {
			var iframe = this.getIFrameEl();
			var action = "new";
			iframe.contentWindow.CheckEventSubTable(action);
		},
		ondestroy: function (action) {
			if(typeof(action)=="object" ){
				grid.addRow(action);
			}
		}
	});
}
// 盘点仓库清单新增
function addStorageList(grid){
	mini.open({
		url: projectName+"/TableDefineAdmin/addstorage_list",
		title: "新增", width: 700, height: 300,
		onload: function () {
			var iframe = this.getIFrameEl();
			var action = "new";
			iframe.contentWindow.CheckEventSubTable(action);
		},
		ondestroy: function (action) {
			console.log(action);
			if(typeof(action)=="object" ){
				grid.addRow(action);
			}
		}
	});
}
// 删除
function delRow(e){
	var btid = e.source.id;//addbt_
	var index = btid.indexOf("_delbt_");
	var grid = mini.get(btid.substring(7+index));
	var rows = grid.getSelecteds();
	for(var i=0; i<rows.length;i++){
		 grid.removeRow(rows[i]);
	}
}

/**渲染操作**/
function onRendererUrl(e){
	var data = mini.decode(e.field);
	if(data && data.length>0){
		var s = '';
		for(var i=0; i<data.length; i++){
			var obj = mini.decode(data[i]);
			//s+='<a class="'+obj['class']+'" href="javascript:'+obj['function']+'('+e.record._uid+')">'+obj.name+'</a>';
			s+='<a class="'+obj['class']+'" style="color:blue;text-decoration:underline;" onclick="'+obj['function']+'('+e.record._uid+')">'+obj.name+'</a>';
			s+='&nbsp;&nbsp;&nbsp;';
		}
		return s;
	}
	
}

function openalert(_uid){
	alert(_uid);
}
/**点击事件**/
function onOperationClick(field){
	if(field == "o13"){ // field 为字段数据库名
		// 点击事件
		alert(1);
	}
}
